DOS Script Arguments

Here is an explanation of how the DOS script gets its query or form data.

Path Information

Scripts can be accessed either through their real name, or through their real name followed by extra path names. This capability is useful for writing filters, or things which need to send specific information to a general-purpose script. The imagemap facility uses this feature.

Example: Say I have a script called viewsrc.bat. If I then add an HREF in a document to http://myserver/htbin/viewsrc.bat/dir1/dir2/source.c, /htbin/view-source will be called with the extra information as defined below. In this case, the extra information is /dir1/dir2/source.c.

A script such as viewsrc.bat is inherently dangerous, because it allows users to see your entire system. A proper script would translate the name into something else.


Search Information

Anything the user types in an <ISINDEX> box, or responds to in a form, will be sent as the query information.

Environment Variables

Your script receives the path information and query string via three CGI environment variables. If a query string was sent, it will be defined as the variable QUERY_STRING In addition, it is passed on the command line for yor script and can be accessed as %1%. If extra path information was included with the URL, it will be defined as the variable PATH_INFO. In addition, the path info will be translated from "virtual" to "physical" (a real DOS path, using the DocumentRoot setting and aliases. This is defined as the variable PATH_TRANSLATED.

Here are three examples that should help you visualize the process. Each of the following URL's calls a script that simply reports on what the script received in the way of arguments and environment variables. You must be reading this document via your server (not in local file mode) for the examples to work.

Move on to decoding your arguments

Return to GET script overview


Robert B. Denny <rdenny@netcom.com>